/*
 * @Description: 
 * @Author: xuzp4
 * @Date: 2022-03-22 09:06:08
 * @LastEditors: xuzp4
 * @LastEditTime: 2022-04-06 11:44:40
 * @FilePath: \visitor_management\src\router\index.js
 */
import Vue from 'vue'
import Router from 'vue-router'
const Layout = () => import('../Layout/index')
const Attendance = () => import('../pages/attendance/index')
const StudentTrajectory = () => import('../pages/studentTrajectory/index')
const DormitoryManagement = () => import('../pages/dormitoryManagement/index')
const StudentManagement = () => import('../pages/studentManagement/index')
Vue.use(Router)

// const allowList = ['home']

const router = new Router({
  mode: 'hash',
  routes: [
    {
      path: '/',
      name: 'index',
      redirect:'/home',
      component: Layout,
      children:[
        {
          path: '/',
          name: 'attendance',
          meta: {
              title: 'attendance'
          },
          component: Attendance
        },
        {
          path: '/student/trajectory',
          name: 'studentTrajectory',
          meta: {
              title: 'studentTrajectory'
          },
          component: StudentTrajectory
        },
        {
          path: '/dormitory/management',
          name: 'dormitoryManagement',
          meta: {
              title: 'dormitoryManagement'
          },
          component: DormitoryManagement
        },
        {
          path: '/student/management',
          name: 'studentManagement',
          meta: {
              title: 'studentManagement'
          },
          component: StudentManagement
        },
      ]
    },

  ]
})

// router.beforeEach((to, from, next) => {
//   if (allowList.includes(to.name)) {
//     next()
//   } else {
//     next()
//   }
// })

export default router
